import {createRouter,createWebHistory,createWebHashHistory} from 'vue-router'
import NProgress from 'nprogress'
const routes = [
  { 
    path:'/',
    redirect:'/home'
  },
  {
    path:'/home',
    component:() => import('@/components/home/index.vue'),
  },
  {
    path:'/login',
    component:() => import('@/components/login/index.vue')
  },
]

const router = createRouter({
  history:createWebHashHistory(),
  routes,
})

router.beforeEach((to,from,next) => {
  next()
  NProgress.start()
})

router.afterEach(() => {
  NProgress.done()
})

export {
  router
}